<?php
class Page_model extends MY_Model {
	
    var $name   = '';
   // var $php_file  = '';
    var $title = '';
    var $content = '';
   // var $parent_id = '';
  	
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    
	public function find_by_name($name) {
		$sql = "SELECT * FROM " . $this->table() . " WHERE valid = ? AND name = ?";
		return $this->db->query($sql, array(1,$name))->result_object();
	}

	public function find_by_name_of_others($id, $name) {
		$sql = "SELECT * FROM " . $this->table() . " WHERE valid = ? AND name = ? AND id != ?";
		return $this->db->query($sql, array(1,$name,$id))->result_object();
	}
}